package com.leps.nq.sys.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.leps.nq.common.vo.PageVo;
import com.leps.nq.sys.entity.SysOperLog;
import com.leps.nq.sys.mapper.SysOperLogMapper;
import com.leps.nq.sys.service.ISysOperLogService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.leps.nq.sys.vo.OperLogQueryModel;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 操作日志记录 服务实现类
 * </p>
 *
 * @author hex
 * @since 2022-05-20
 */
@Service
public class SysOperLogServiceImpl extends ServiceImpl<SysOperLogMapper, SysOperLog> implements ISysOperLogService {

    @Override
    public PageVo<SysOperLog> listByQueryModel(OperLogQueryModel queryModel) {
        Page<SysOperLog> page = Page.of(queryModel.getPageNum(), queryModel.getPageSize());
        page = this.getBaseMapper().selectByQueryModel(page, queryModel);
        return PageVo.of(page);
    }

    @Override
    public void deleteByIds(Long[] id) {
        this.getBaseMapper().deleteOperLogByIds(id);
    }

    @Override
    public void clear() {
        this.getBaseMapper().cleanOperLog();
    }
}
